#!/bin/sh

# h264_nvenc is for using gpu to encode
# use libx264 for cpu

set $(slop -q -o -f '%x %y %w %h')

notify-send "FFmpeg" "Gravação da tela iniciada!"

ffmpeg -s ${3}x${4} \
-f x11grab \
-i :0.0+${1},${2} \
-f alsa \
-ac 2 \
-i loopout \
-c:v h264_nvenc \
-cq 19 \
-r 30 \
-y ~/Videos/record_`date +%d-%m-%Y_%H:%M`.mkv \
> /dev/null 2>&1
